require 'rubygems'
gem 'soap4r'
require 'soap/wsdlDriver'
require 'soap/header/simplehandler'
require 'defaultDriver.rb'
require 'authStub.rb'
require 'WSHelpers.rb'

props = {
  :object => 'Send',
  :props => ['EmailName','NumberSent','NumberDelivered','UniqueOpens','UniqueClicks','SendDate','Email.ID']
}

#Set date to pull from
dateFrom = (DateTime.now - 60).strftime("%m/%d/%y")
#Declare the send filter criteria
filter = {
  :filterType => 'Simple',
  :filter => ['SendDate','greaterThan',dateFrom]
}

sends = BuildRetrieve.new
resp = sends.creates(props,filter)

resp.results.each do |result|
  puts result.emailName.strip + " - " + result.numberSent.to_s + " - " + result.numberDelivered.to_s + " - " + result.sendDate.to_s
end